package com.kgc.controller;

import com.kgc.common.Result;
import com.kgc.entity.Reply;
import com.kgc.service.interf.ReplyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/apis/user/reply")
public class ReplyController {
    @Autowired
    private ReplyService replyService;

    /**
     * 回复评论
     * @param reply
     * @return
     */
    @RequestMapping("/add")
    public String add(Reply reply){
        int i = replyService.addReply(reply);
        if (i>0){
            return Result.success("200","回复成功");
        }else {
            return Result.success("500","回复失败");
        }
    }

    /**
     * 查询回复
     * @param
     * @return
     */
    @RequestMapping("/show")
    public String show(){
        if (replyService.findReplyList()==null){
            return Result.success("500","查询失败");
        }
        return Result.success("200","查询成功",replyService.findReplyList());
    }
}
